﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using League.Entity;
using League.DBUtility;
using System.Data;
using System.Data.SqlClient;

namespace League.DataAccess
{
    public class LeagueInfoDataAccess
    {
        public static string Insert(LeagueInfo leagueInfo)
        {
            string result = string.Empty;

            SqlParameter[] parms = {
                                       new SqlParameter("LeagueName", leagueInfo.LeagueName),
                                       new SqlParameter("SeasonYear", leagueInfo.SeasonYear),
                                       new SqlParameter("Note", string.Empty)
                                   };
            result = LeagueSQLHelper.ExecuteScalar(CommandType.StoredProcedure,
                "LeagueInfoInsert", parms).ToString();

            return result;
        }

        public static List<LeagueInfo> GetAllLeagueInfo()
        {
            string sql = "SELECT * FROM LeagueInfo WHERE IsDeleted = 0";

            return LeagueSQLEntityHelper<LeagueInfo>.GetEntitySet(sql);
        }
    }
}
